package com.gitee.wsl.time.exception


/**
 * An exception thrown when an error occurs during parsing.
 *
 *
 * This exception includes the text being parsed and the error index.
 *
 * @implSpec
 * This class is intended for use in a single thread.
 *
 * @since 1.8
 */
class DateTimeParseException : DateTimeException {
    /**
     * Returns the string that was being parsed.
     *
     * @return the string that was being parsed, should not be null.
     */
    /**
     * The text that was being parsed.
     */
    val parsedString: String
    /**
     * Returns the index where the error was found.
     *
     * @return the index in the parsed string that was invalid, should be a valid index
     */
    /**
     * The error index in the text.
     */
    val errorIndex: Int

    /**
     * Constructs a new exception with the specified message.
     *
     * @param message  the message to use for this exception, may be null
     * @param parsedData  the parsed text, should not be null
     * @param errorIndex  the index in the parsed string that was invalid, should be a valid index
     */
    constructor(message: String?, parsedData: CharSequence, errorIndex: Int) : super(message) {
        this.parsedString = parsedData.toString()
        this.errorIndex = errorIndex
    }

    /**
     * Constructs a new exception with the specified message and cause.
     *
     * @param message  the message to use for this exception, may be null
     * @param parsedData  the parsed text, should not be null
     * @param errorIndex  the index in the parsed string that was invalid, should be a valid index
     * @param cause  the cause exception, may be null
     */
    constructor(message: String?, parsedData: CharSequence, errorIndex: Int, cause: Throwable?) : super(
        message,
        cause
    ) {
        this.parsedString = parsedData.toString()
        this.errorIndex = errorIndex
    }


}